package com.zegoto.mail.controller;

import com.zegoto.mail.service.ThreadTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.time.Instant;

@Controller
public class IndexController {


    @Autowired
    private ThreadTask threadTask;


    @RequestMapping("/")
    public @ResponseBody
    String hello(){

        threadTask.exec();

//        ThreadLocal<String> threadLocal = new ThreadLocal<>();
//        threadLocal.set("123");
//        threadLocal.get();





        return "hello";
    }


    @RequestMapping("/hi/{id}")
    public @ResponseBody
    String hi(@PathVariable("id") String id){
        return "hello > " + id;
    }

    public static void main(String[] args) {


        System.out.println(Instant.now().getEpochSecond());

    }


}
